from myelin.Ns import MYELIN, FOAF, DC, DCTERMS

from myelin.rdf.bindery.ObjectTypes import LiteralTypeO

from Resource import Resource
from Document import Document

#import Agent

from ObjectTypes import \
    TextIndexTypeO, TextIndexTypeS, \
    TextIndexDocumentTypeO, TextIndexDocumentTypeS, \
    ResourceTypeO

from mappings import \
    TextIndexMap, \
    IndexTypesMap


class TextIndex(Resource):
    
    ModelTypes = (TextIndexTypeO, TextIndexTypeS)
    
    RDF_BINDINGS = {
        'mPrimary_Type'         : ((MYELIN, 'primary-type'), ResourceTypeO, IndexTypesMap),
        'mHas_Document'         : ((MYELIN, 'for-index'), TextIndexDocumentTypeS, TextIndexMap),
    }
    
    def rdf_getDomain(self):
        self.rdf_domain = self.rdf_scope
        return self.rdf_domain
    

class TextIndexDocument(Document):
    
    ModelTypes = (TextIndexDocumentTypeO, TextIndexDocumentTypeS)
    
    RDF_BINDINGS = {
        'mFor_Index'            : ((MYELIN, 'for-index'), TextIndexTypeO, TextIndexMap),
    }

    
CLASS_TYPES = {
    MYELIN + 'TextIndex'            : TextIndex,
    MYELIN + 'TextIndexDocument'    : TextIndexDocument,
}